from flask import jsonify, current_app


def response_ok(data=None):
    response = {"code": 0, "msg": "ok", "data": data}
    current_app.logger.info(f"响应参数: {response}")
    return jsonify(response)


def response_page_ok(page_num, page_size, count, data):
    response = {"code": 0, "msg": "ok", "page_num": page_num, "page_size": page_size, "count": count, "data": data}
    current_app.logger.info(f"响应参数: {response}")
    return jsonify(response)


def response_error(msg):
    response = {"code": -1, "msg": msg}
    current_app.logger.info(f"响应参数: {response}")
    return jsonify(response)


